MAPS

Water sources in Africa

Point Dot Map

Photo by Adebayo Alabi on Unsplash

Photo by Adebayo Alabi on Unsplash

Access to safe water is a fundamental human need and therefore a basic human right…
— Kofi Annan


Ingest

# Data source must have an ISO3 field
df <- read.csv("archetypes/water-sources-in-africa/water.csv", header = TRUE)
df

Wrangle

df_wrangled <- df %>%
  # Delete dots not within the latitude/longitude of africa
  filter(lon_deg>=-20 & lon_deg<=50 & lat_deg>=-30 & lat_deg<=40) %>%
  # Further delete dots in the upper-top, which does not belong to africa
  filter(!(lon_deg>=40 & lat_deg>=20)) %>%
  replace_na(list(water_source="Unknown")) %>%
  mutate(water_source = case_when(
    str_detect(water_source, "Spring") ~ "Spring",
    str_detect(water_source, "Shallow Well") ~ "Shallow Well",
    str_detect(water_source, "Surface Water") ~ "Surface Water",
    TRUE ~ water_source)) %>%
  select(latitude = lat_deg, longitude = lon_deg, water_source)

df_wrangled

African map

# Filter and keep only african countries
african_countries <- world %>% 
  filter(continent == "Africa", !is.na(iso_a2))

Plot - Rebecca’s version

fill by “water source” status

v1 <- ggplot(df_wrangled) +
  geom_sf(data = african_countries,
          aes(geometry=geom), fill = "grey90", color="white") +
  geom_hex(aes(x = longitude, y = latitude, fill = water_source),
           bins = 80, alpha = 0.6)+
  theme_void() +
  scale_fill_brewer(palette = "Set3") +
  theme(legend.position = c(0.15, 0.25),
        title = element_text(family = "Baloo"),
        plot.title = element_text(size = 26)) +
   # add those labels
  labs(title = "Water sources in Africa installed since 1900", fill = "Water Source",
       caption = "data from Water Point Data Exchange | plot by @rjstevick for #TidyTuesday")


girafe(ggobj = v1, width_svg = 16, height_svg = 16,
       options = list(opts_sizing(rescale = TRUE, width = 1.0))
)

Plot - My own version

fill by “water source” status

v1 <- ggplot(df_wrangled) +
  geom_sf(data = african_countries,
          aes(geometry=geom), fill = "grey90", color="white") +
  geom_hex(aes(x = longitude, y = latitude),
           bins = 150, alpha = 0.6)+
  theme_void() +
  # scale_fill_brewer(palette = "Set3") +
  theme(legend.position = c(0.9, 0.9),
        title = element_text(family = "Baloo"),
        plot.title = element_text(size = 26)) +
   # add those labels
  labs(title = "Water sources in Africa installed since 1900", fill = "Water Source")


girafe(ggobj = v1, width_svg = 16, height_svg = 16,
       options = list(opts_sizing(rescale = TRUE, width = 1.0))
)

References

citations for narrative and data sources

  • Narrative sources: This is a reproduction of an original plot by Rebecca Stevick for #TidyTuesday, GO
  • Data sources: TidyTuesday 2021 week 19 - Water Point Data Exchange, GO